import { createRouter, createWebHashHistory } from 'vue-router'
import HomeView from '../views/home/index.vue'
import KindView from '../views/kind/index.vue'
import CartView from '../views/cart/index.vue'
import UserView from '../views/user/index.vue'


const routes = [
  {
    path: '/',
    // redirect 设置路由的重定向，修改路由的路径
    redirect: '/home'
  },
  {
    path: '/home',
    name: 'home',
    component: HomeView
  }, {
    path: '/kind',
    name: 'kind',
    component: KindView
  },
  {
    path: '/cart',
    name: 'cart',
    component: CartView
  },
  {
    path: '/user',
    name: 'user',
    component: UserView
  },
  // {
  //   path: '/about',
  //   name: 'about',
  //   // route level code-splitting
  //   // this generates a separate chunk (About.[hash].js) for this route
  //   // which is lazy-loaded when the route is visited.
  //   component: () => import('../views/AboutView.vue')
  // }
]

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes
})


export default router
